{% extends "docentes/index.html" %}
{% load i18n %}
{% block title %}{% trans 'Página Horas de Serviço do Docente'%}{% endblock %}
{% block breadcrumb %}
<ul class="breadcrumb">
	<li>
		<span class="glyphicon glyphicon-home"></span> <a tabindex="2" href="{% url homeDocente %}" title="{% trans 'Home' %}">{% trans 'Home' %}</a>
	</li>
	<li class="active">{% trans 'Horas de serviço do Docente' %}</li>
</ul>
{% endblock %}

{% block menuInfoDocente %} {% endblock %}
{% block menuHoraTrab %}class="active"{% endblock %}


{% block content %}
	<div class="page-header whiteText">
	  <h1>{% trans 'Horas de Serviço'%}<small>{% trans ' Ano '%}{{anoActual}} </small></h1>
	</div>
	
	<form id= "form_report" method="post" action ="{%url print_pdf %}" role="form">
		{% csrf_token %}
		<input id = "hidden_inputDados" name ="table_json" type="hidden"/>
		<input id = "dados_report" value ="{%trans 'Horas de Serviço do Docente'%}" name ="tituloReport" type="hidden"/>
		<input id = "ano_report" value ="{{anoActual}}" name ="ano" type="hidden"/>
		<input id = "user_report" value ="{{user.first_name}} {{user.last_name}}" name ="user_name" type="hidden"/>
		<input id = "tipoReport" value ="1" name ="tipoReport" type="hidden"/>
		<input id="button_print" value ="{%trans 'Imprimir'%}" type="button" class="btn btn-primary"/>
	</form>
	
	<form id="filter_ano_form" class="form-horizontal" role="form">
		 <div class="form-group whiteText">
	   	 	<div class="col-xs-2">
		      {%for field in form_combo%}
		      	{{ field.label_tag }}: {{ field }}
		      {%endfor%}  
	    	</div>
	  	</div>
	</form>

	<table cellpadding="0" cellspacing="0" border="0" class="display sumary_table" id="special_table" width="100%">
		<thead>
			<tr>
				<th class="cabecalho_sumario">{% trans 'Curso' %}</th>
				<th class="cabecalho_sumario">{% trans 'Turma' %}</th>
				<th class="cabecalho_sumario">{% trans 'Horas de Serviço' %}</th>
				
			</tr>
		</thead>
		<tbody>
			{%for id, turma, horas, curso in lista%}
			<tr>
				<td>{{ curso }}</td>
				<td>{{ turma }}</td>
				<td class="horas_servico">{{ horas }}</td>
			</tr>
			{%endfor%}
		</tbody>
		<tfoot>
		<tr>
			<th colspan="2" class="sub_cabecalho">Horas Total</th>
			<th>{{numeroTotalHoras}} </th>
		</tr>
	</tfoot>
	</table>

<script type="text/javascript">
	$(document).ready(function() {
		$('#special_table').dataTable({
			"oLanguage" : {
				"sUrl" : "/static/dataTables/lang/pt-pt.txt"
			},
			"sPaginationType" : "full_numbers",
			"sDom" : '<"dataTables_special_bar"l><"dataTables_special_bar"if><"whiteBox"rt><"pagination_box"p>'

		});
		$('.hasTooltip').tooltip({
			"container" : false
		});
		
		
		$("#button_print").click(function(){
			var table = $('#special_table').tableToJSON();
			var dados_tableStr = JSON.stringify(table);
			
			$("#hidden_inputDados").val(dados_tableStr);
			$("#form_report").submit();
		});
		
	}); 
</script>

{% endblock %}